home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0150_Re: Find the row-col in TMemo objects.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-30  |  508 b   |  15 lines

  1.  
  2. Row := SendMessage(MyMemo.Handle, EM_LINEFROMCHAR, $FFFF, 0);
  3.  
  4. will return the line number of the caret position in variable Row.
  5.  
  6. RowStart := SendMessage(MyMemo.Handle, EM_LINEINDEX, $FFFF, 0);
  7.  
  8. will return the character index of the start of the line.
  9. Subtract RowStart from MyMemo.SelStart to get the column position.
  10.  
  11. MyRow := SendMessage(MyMemo.Handle, EM_LINEFROMCHAR, $FFFF, 0);
  12. MyRowStart := SendMessage(MyMemo.Handle, EM_LINEINDEX, $FFFF, 0);
  13. MyCol := MyMemo.SelStart - MyRowStart;
  14.  
  15.